﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.Encodings.Web;
using System.Text.Json.Serialization;
using System.Text.Json;
using System.Threading.Tasks;

namespace BuddHa.Wechat.Mini
{
    public class ConstWechat
    {
        public const string AccessTokenUri = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid={0}&secret={1}";
        public const string GetWxACodeUri = "https://api.weixin.qq.com/wxa/getwxacodeunlimit?access_token={0}";
        public const string WechatJscode2Session = "https://api.weixin.qq.com/sns/jscode2session?appid={0}&secret={1}&js_code={2}&grant_type={3}";
        public const string GetUserEncryptKey = "https://api.weixin.qq.com/wxa/business/getuserencryptkey?access_token={0}&openid={1}&signature={2}&sig_method={3}";
        public const string GetUserPhoneNumber = "https://api.weixin.qq.com/wxa/business/getuserphonenumber?access_token={0}&code={1}";
        public const string GetAccessToken = "GetAccessToken";
        public const string GetWxACodePage = "pages/home/home";
        public static JsonSerializerOptions CreateDefaultJsonSerializerOptions()
        {
            return new JsonSerializerOptions()
            {
                Encoder = JavaScriptEncoder.UnsafeRelaxedJsonEscaping,
                //反序列化过程中属性名称不区分大小写的比较
                PropertyNameCaseInsensitive = true,
                DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull
            };
        }
        public static readonly string WechatOptionName = "WechatOption";
        public const string Token = "weixin";
        //微信回调成功返回
        public const string Success = "success";
        //微信回调失败返回
        public const string Filed = "filed";
    }
}
